/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.soc.cs5226.gui.reports.beans;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author Huimin
 */
@ManagedBean
@RequestScoped
public class ReportsBean {

    private java.util.Date startDate;
    private java.util.Date endDate;
    private int DBParam;
    
    public ReportsBean(){
        
    }
    
    public ReportsBean(java.util.Date startDate, java.util.Date endDate, int DBParam){
        this.startDate = startDate;
        this.endDate = endDate;
        this.DBParam = DBParam;
    }
    
    public java.util.Date getEndDate() {
        return endDate;
    }

    public void setEndDate(java.util.Date endDate) {
        this.endDate = endDate;
    }

    public java.util.Date getStartDate() {
        return startDate;
    }

    public void setStartDate(java.util.Date startDate) {
        this.startDate = startDate;
    }
        
    public int getDBParam() {
        return DBParam;
    }

    public void setDBParam(int DBParam) {
        this.DBParam = DBParam;
    }
    
    public void genSvcRpt() {
        String [] args = new String [3];
        args[0] = new Integer(DBParam).toString();
        args[1] = new Long (startDate.getTime()).toString();
        args[2] = new Long (endDate.getTime()).toString();
        GenerateReports.main(args);
        
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Generated Successfully"));
    }
    
}
